POV-Ray : Newsgroups : povray.general : Help! Can anyone figure this math? : Re: Help! Can anyone figure this math? Server Time
16 Nov 2024 09:22:25 EST (-0500)
  Re: Help! Can anyone figure this math?  
From: Peter Popov
Date: 30 Aug 1998 02:52:44
Message: <35e8e8ac.0@news.povray.org>
Well, seems to me eveeryone's working on the trigonometric solution...
here's a cheep 'n' cheesy one. You'll need two points on each surface,
though (and their order must match)

#declare A1=<Ax,Ay,Az> // point A1
#declare B1=<Bx,By,Bz>  // point B1
#declare A2=<Ax,Ay,Az> // point A2
#declare B2=<Bx,By,Bz>  // point B2
#declare tangentA=<tAx,tAy,tAz> // tangent at A
#declare tangentB=<tBx,tBy,tBz>  // tangent at B

// The tangents of the surfaces have to point in the direction of the
joining surface.
// Anyway that's easy to correct with a tangentA_direction (+1 or -1) etc.

#declare weightA = 1  // how strongly the tangent of A "attracts" the
tangent of the joining surface
#declare weightB = 1  // same as above

#declare addToA = weightA*tangentA
#declare addToB = weightB*tangentB

bicubic_patch
{ type 1
   flatness 0
   u_steps 4
   v_steps 4
    A1, (A1+A2)/3, (A1+A2)*2/3, A2,
    A1, (A1+A2)/3+addToA, (A1+A2)*2/3+addToA, A2+addToA,
    B1, (B1+B2)/3+addToB, (B1+B2)*2/3+addToB, A2+addToB,
    B1, (B1+B2)/3, (B1+B2)*2/3, B2,
}

I haven't tested this, but it looks OK to me. Of course, you can't use it in
CGS. If you want to do intersections and/or differences, try using prisms
instead. Well, they extrude along y, so you'll have be careful. Also, when
using a cubic_spline in prisms keep in mind it starts from the second point
and ends at the second-to-last, so the tangents should point opposite to
what is used above, plus you'll have to interchange points 1&2 and points
3&4 from the above example.

Hope this helps.

--Peter

pet### [at] usanet



Philippe Debar wrote in message <35e71797.0@news.povray.org>...
>I was totally unable to solve this problem for a pov scene.
>I found a workaround, but I am not totally satisfied with it.
>
>The problem is to get a smooth joint between differently
>oriented surfaces. In this case, two boxes rotated around
>the z-axis. I wanted to use a scaled cylinder (to get an
>ellipse). What are (1) the location of the center of the scaled
>cylinder, (2) the 'left' x radius and (3) the 'up' y radius to get
>the cylinder tangeant to the boxes. I don't think that rotating the
>cylinder around the z-axis is necessary.
>
>I tried to solve the problem with the following equations:
>
>An ellipse has to passes through point A(Xa, Ya) and
>B(Xb, Yb). Its axis are parallel to the main axis. The
>orientation of the tangent in A and B are given: Ta, Tb
>
>P0(X0, Y0) the 'center' of the ellipse (center of a
>scaled circle)
>As I use a scaled circle, I use semi-axis of R and
>s*R
>
>So we have for each point
>
>(Xa-X0)^2+(Ya-Y0)^2/L^2=R^2
>
>this is equivalent to
>
>Xa = X0 + R cos(Aa)
>Ya = Y0 + L R sin(Aa)
>
>Aa is the parametric angle A for point A
>(note that this is in on way the real angle
>from OX to OA)
>
>And the tangent:
>Xa'= -R sin(Aa)
>Ya'= L R cos(Aa)
>
>=> Ta = Ya' / Xa' =  -L / tan(Aa)
>
>...same equations for point B...
>
>So we have a system of 6 equations, with 6 unknowns:
>X0, Y0, R, L, Aa, Ab.
>Aa an Ab are of no interrest but can be necessary
>to solve the system.
>
>I tried but was unable to get an answer - it was to
>complicated for me, and I can no longer access
>a copy of Mathematica, so...
>
>
>Any help welcome,
>
>Thank you very much,
>
>Philippe
>
>


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.